using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace InfiniTec.Security
{
    /// <summary>
    /// Provides setup information for the <see cref="DialogImpersonationScope"/>.
    /// </summary>
    public class DialogImpersonationScopeInfo
    {
        private LogonType _LogonType;

        /// <summary>
        /// Gets or sets the <see cref="LogonType"/> to use for impersonation.
        /// </summary>
        public LogonType LogonType
        {
            get { return _LogonType; }
            set { _LogonType = value; }
        }

        private string _DefaultUsername;

        /// <summary>
        /// Gets or sets the username that is displayed to the user
        /// </summary>
        public string DefaultUsername
        {
            get { return _DefaultUsername; }
            set { _DefaultUsername = value; }
        }

        private string _MessageText;

        /// <summary>
        /// Gets or sets the message text that is displayed in the credential request dialog
        /// </summary>
        public string MessageText
        {
            get { return _MessageText; }
            set { _MessageText = value; }
        }

        private QueryCredentialOptions _Options;

        /// <summary>
        /// Gets or sets the options used for the credential request dialog. 
        /// See <see cref="QueryCredentialOptions"/> for more information.
        /// </summary>
        public QueryCredentialOptions Options
        {
            get { return _Options; }
            set { _Options = value; }
        }

        
        private string _Caption;

        /// <summary>
        /// Gets or sets the caption that is displayed in the credential request dialog.
        /// </summary>
        public string Caption
        {
            get { return _Caption; }
            set { _Caption = value; }
        }

        private Bitmap _Image;

        /// <summary>
        /// Gets or sets the image that is displayed in the credential request dialog.
        /// </summary>
        public Bitmap Image
        {
            get { return _Image; }
            set { _Image = value; }
        }

        private string _TargetName;

        /// <summary>
        /// Gets or sets the targetname that is used for the impersonation Scope.
        /// </summary>
        public string TargetName
        {
            get { return _TargetName; }
            set { _TargetName = value; }
        }

        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo()
        {
        }
        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName) : this(targetName, null, null) { }
        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName, string messageText, string captionText) : this(targetName, "", messageText, captionText) { }
        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName, string defaultUsername, string messageText, string captionText)
            :
            this(targetName, defaultUsername, messageText,captionText, null) {}
        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName, string defaultUsername, string messageText, 
            string captionText, Bitmap image): this(targetName, defaultUsername, LogonType.Interactive, 
            messageText, captionText, image, QueryCredentialOptions.CompleteUsername | 
            QueryCredentialOptions.ValidateUsername | QueryCredentialOptions.DoNotPersist) {}

        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName, string defaultUsername, LogonType logonType, 
            string messageText, string captionText, Bitmap image): this(targetName, defaultUsername, 
            logonType, messageText, captionText, image, QueryCredentialOptions.CompleteUsername |
            QueryCredentialOptions.ValidateUsername | QueryCredentialOptions.DoNotPersist) { }

        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName, QueryCredentialOptions options) : this(targetName, "", options) { }
        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName, string defaultUsername, 
            QueryCredentialOptions options): this(targetName, defaultUsername, LogonType.Interactive, null, 
            null, null, options) {}
        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName, string messageText, string captionText, 
            QueryCredentialOptions options): this(targetName, "", LogonType.Interactive, messageText, 
            captionText, null, options) {}
        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName, string messageText, string captionText, Bitmap image, QueryCredentialOptions options)
            : this(targetName, "", LogonType.Interactive, messageText, captionText, image, options) { }
        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        public DialogImpersonationScopeInfo(string targetName, string defaultUsername, LogonType logonType,
            string messageText, string captionText, Bitmap image, QueryCredentialOptions options)
        {
            _TargetName = targetName;
            _MessageText = messageText;
            _Caption = captionText;
            _Image = image;
            _Options = QueryCredentialOptions.DoNotPersist | QueryCredentialOptions.ValidateUsername;
            _Options = options;
            _LogonType = logonType;
            _DefaultUsername = defaultUsername;
        }

    }
}
